package com.edu.controller;

import com.edu.domain.Business;
import com.edu.service.BusinessService;
import com.edu.service.impl.BusinessServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public class BusinessController {


    private BusinessService businessService=new BusinessServiceImpl();
    /**
     * http://localhost:8080/BusinessController/listBusinessByOrderTypeId?orderTypeId=1
     */
 public Object listBusinessByOrderTypeId(HttpServletRequest request){
     int orderTypeId= Integer.parseInt(request.getParameter("orderTypeId"));
     List<Business> list=this.businessService.listBusinessByOrderTypeId(orderTypeId);
     return list;

 }

    /**
     * http://localhost:8080/BusinessController/getBusinessById?businessId=10001
     * @param request
     * @return
     */
 public Object getBusinessById(HttpServletRequest request){
     int businessId= Integer.parseInt(request.getParameter("businessId"));
     Business business=this.businessService.getBusinessById(businessId);
     return business;

 }

}
